/**
 * Created by yk on 2017/9/28.
 */
//console.log(document.documentElement.clientWidth);
document.documentElement.style.fontSize = document.documentElement.clientWidth / 640 * 100 + "px";
if(document.documentElement.clientWidth>640){
    document.documentElement.style.fontSize=100+"px";
}

//横屏无效
window.addEventListener("orientationchange", function() {
    // Announce the new orientation number
    if(0!==window.orientation){
        // $('.container').hide().after("<div  style='text-align: center'>请竖屏浏览</div>");
        alert('请竖屏浏览')
    }else{
        // $('.container').show().next().empty();
    }
}, false);

//
//document.documentElement.style.height = window.innerHeight + 'px';
//禁止拖动
window.addEventListener("touchmove", function(e) {
    // Announce the new orientation number
    e.preventDefault();
}, false);
//表单序列化
function arry2json(arry){
    if(!arry.length){
        console.log('bad form');
        return;
    }
    var newArry={};
    for(var i=0;i<arry.length;i++){
        newArry[arry[i]['name']]=arry[i]['value'];
    }
    return newArry;
}
//弹窗
function layer_msg(mgs) {
    layer.open({
        content: mgs,
        skin: 'msg',
        time: 2
    });
}
function layer_cofirm(mgs,url) {
        layer.open({
            content: mgs,
            btn: ['确定', '取消'],
            style: 'font-size:.32rem',
            shadeClose: false,
            yes: function(index) {
                location.href =url;
                layer.close(index);
            }
        });
    }

    function preventMove(){
        document.addEventListener('touchmove', function(e) {
            e.preventDefault();
        }, false);
    }
